package com.ruoyi.basebill.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.basebill.domain.OmsOtherissuebill;
import com.ruoyi.basebill.service.IOmsOtherissuebillService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 其他出库单Controller
 * 
 * @author wenxyiong
 * @date 2023-02-18
 */
@RestController
@RequestMapping("/settlementCenter/basebill/otherissuebill")
public class OmsOtherissuebillController extends BaseController
{
    @Autowired
    private IOmsOtherissuebillService omsOtherissuebillService;

    /**
     * 查询其他出库单列表
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:list')")
    @GetMapping("/list")
    public TableDataInfo list(OmsOtherissuebill omsOtherissuebill)
    {
        startPage();
        List<OmsOtherissuebill> list = omsOtherissuebillService.selectOmsOtherissuebillList(omsOtherissuebill);
        return getDataTable(list);
    }

    /**
     * 导出其他出库单列表
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:export')")
    @Log(title = "其他出库单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OmsOtherissuebill omsOtherissuebill)
    {
        List<OmsOtherissuebill> list = omsOtherissuebillService.selectOmsOtherissuebillDetailList(omsOtherissuebill);
        ExcelUtil<OmsOtherissuebill> util = new ExcelUtil<OmsOtherissuebill>(OmsOtherissuebill.class);
        util.exportExcel(response, list, "其他出库单数据");
    }

    /**
     * 获取其他出库单详细信息
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(omsOtherissuebillService.selectOmsOtherissuebillById(id));
    }

    /**
     * 新增其他出库单
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:add')")
    @Log(title = "其他出库单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OmsOtherissuebill omsOtherissuebill)
    {
        return toAjax(omsOtherissuebillService.insertOmsOtherissuebill(omsOtherissuebill));
    }

    /**
     * 修改其他出库单
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:edit')")
    @Log(title = "其他出库单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OmsOtherissuebill omsOtherissuebill)
    {
        return toAjax(omsOtherissuebillService.updateOmsOtherissuebill(omsOtherissuebill));
    }

    /**
     * 删除其他出库单
     */
    @PreAuthorize("@ss.hasPermi('settlementCenter/basebill:otherissuebill:remove')")
    @Log(title = "其他出库单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(omsOtherissuebillService.deleteOmsOtherissuebillByIds(ids));
    }
}
